<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // 浅拷贝，把对象第一层的属性和值，拷贝给另一个对象
    let obj1 = {title: 'aaaaa', subject: '前端'}

    // --------------- 直接赋值 -------------- 
    // let obj2 = obj1  //(直接赋值，赋值的是地址)
    // obj2.title = 'bbbbb'

    // --------------- 浅拷贝 -------------- 
    let obj2 = {...obj1}
    obj2.title = 'bbbbb'

    console.log(obj1, obj2);
  </script>
</body>
</html>